﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TradeDataAPI.Core.Common.Enum
{
    public enum ReviewStatus
    {
        PendingReview = 0,      // 待审核
        DuplicateInvalid = 1,   // 重复无效
        Invalid = 2,            // 无效
        Processed = 3,         // 待处理
        FixedCompleted = 4,      // 修复已完成
        

    }


    public class ReviewStatusHelper
    {

        /// <summary>
        /// 根据值获取枚举的描述
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public static string GetDescription(ReviewStatus status)
        {
            switch (status)
            {
                case ReviewStatus.PendingReview:
                    return "PendingReview";//待审核
                case ReviewStatus.DuplicateInvalid:
                    return "DuplicateInvalid";//重复无效
                case ReviewStatus.Invalid:
                    return "Invalid";//无效
                case ReviewStatus.Processed:
                    return "Processed";//待处理
                case ReviewStatus.FixedCompleted:
                    return "FixedCompleted";//修复已完成
                default:
                    throw new ArgumentOutOfRangeException(nameof(status), status, null);
            }
        }

        /// <summary>
        /// 根据枚举名称获取枚举值
        /// </summary>
        /// <param name="statusName"></param>
        /// <returns></returns>
        public static int GetEnumValueByStringAsync(string statusName)
        {
            // 尝试将字符串转换为枚举值
            if (ReviewStatus.TryParse(statusName, out ReviewStatus status))
            {
                // 获取枚举值对应的整数值
                int statusValue = (int)status;
                return statusValue;
            }
            else
            {
                return -1;
            }

        }



    }
}
